<%@ page import="yanglei.day0109.travel.dao.TourRouteDao" %>
<%@ page import="yanglei.day0109.travel.dao.impl.TourRouteDaoImpl" %>
<%@ page import="java.util.Map" %>
<%@ page import="java.util.HashMap" %>
<%@ page import="java.util.List" %>
<%@ page import="yanglei.day0109.travel.po.TourRoute" %>
<%@ page import="yanglei.day0109.travel.constants.TrTypeStatus" %><%--
  Created by IntelliJ IDEA.
  User: 杨雷
  Date: 2023/1/9
  Time: 20:05
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <meta charset="utf-8">
    <title>青年旅行社服务平台</title>
    <link rel="stylesheet" href="../../../css/yanglei/day0110/travelagency.css" type="text/css">
    <%
        TourRouteDao tourRouteDao = new TourRouteDaoImpl();
        Map<String,Object> map = new HashMap<>();
        String searchName = request.getAttribute("searchName") == null ? "" :
                String.valueOf(request.getAttribute("searchName"));
        if (!"".equals(searchName)) {
            map.put("trName", searchName);
        }
        List<TourRoute> tourRoutes = tourRouteDao.queryTourRouteByType(map);

    %>
</head>
<body>
<div id="container">
    <header>
        <h3>青年旅行社服务平台</h3>
    </header>
    <div id="main_body">
        <div id="main_center">
            <form method="post" action="travelagencyController.jsp">
                <div id="search">
                    <button name="btnSeach" id="ch"><a href="addInformation.jsp">添加</a></button>
                </div>
                <table>
                    <thead>
                    <tr>
                        <th>旅行线路名称</th>
                        <th>类型</th>
                        <th>价格(元)</th>
                        <th>咨询电话</th>
                        <th>咨询人</th>
                        <th>创建日期</th>
                        <th>操作</th>
                    </tr>
                    </thead>
                    <tbody>
                    <%
                        for (int i = 0;i<tourRoutes.size();i++){
                    %>
                    <tr>
                        <td><%=tourRoutes.get(i).getTrName()%></td>
                        <td><%=TrTypeStatus.getUserStatusByCode(tourRoutes.get(i).getTrType()).getValue()%></td>
                        <td><%=tourRoutes.get(i).getTrPrice()%></td>
                        <td><%=tourRoutes.get(i).getTrPhone()%></td>
                        <td><%=tourRoutes.get(i).getTrUser()%></td>
                        <td><%=tourRoutes.get(i).getCreateTime()%></td>
                        <td><a href="#">详情</a>&nbsp;<a href="#">删除</a></td>
                    </tr>
                    <%
                        }
                    %>

                    </tbody>
                </table>
            </form>
        </div>
    </div>
</div>
</body>
</html>
